import 'dart:convert';

import 'package:flutterproject/generated/json/address_bean.g.dart';
import 'package:flutterproject/generated/json/base/json_field.dart';

@JsonSerializable()
class AddressBean {
  String? base;
  String? detail;
  int? id;
  String? name;
  String? tel;
  int? top;

  AddressBean();

  factory AddressBean.fromJson(Map<String, dynamic> json) =>
      $AddressBeanFromJson(json);

  Map<String, dynamic> toJson() => $AddressBeanToJson(this);

  AddressBean copyWith(
      {String? base,
      String? detail,
      int? id,
      String? name,
      String? tel,
      int? top}) {
    return AddressBean()
      ..base = base ?? this.base
      ..detail = detail ?? this.detail
      ..id = id ?? this.id
      ..name = name ?? this.name
      ..tel = tel ?? this.tel
      ..top = top ?? this.top;
  }

  @override
  String toString() {
    return jsonEncode(this);
  }
}
